<template>
  <div class='wrap' v-show="showPopover">
    <van-popover
      v-model="showPopover"
      trigger="click"
      overlay
      :placement="placement"
      :actions="actions"
      @select="onSelect"
    >
      <template #reference>

      </template>
    </van-popover>
   </div>
</template>

<script>
import bus from '@/utils/bus'
export default {
  name: 'Popover',
  components: {},
  props: {
    placement: {
      type: String,
      default: 'left-end'
    }
  },
  data () {
    return {
      showPopover: false,
      // 通过 actions 属性来定义菜单选项
      actions: [{ text: '选项一' }, { text: '选项二' }, { text: '选项三' }]
    }
  },
  mounted () {
    bus.$on('onClickCha', () => {
      this.showPopover = true
    })
  },
  methods: {
    onSelect (action) {
      this.$toast(action.text)
    }
  }
}
</script>
<style lang="scss" scoped>
</style>
